﻿Public Module mFunc

    Public Function ReadNextValue(ByRef line As String) As String

        Dim R As String

        line = Trim(line)

        If Left(line, 1) = Chr(34) Then
            R = Mid(line, 2, InStr(2, line, Chr(34)) - 2)
            line = Right(line, (line.Length - R.Length) - 2)
        Else
            If InStr(line, " ") > 0 Then
                R = Left(line, InStr(line, " ") - 1)
                line = Right(line, line.Length - R.Length - 1)
            Else
                R = line
                line = ""
            End If
        End If

        Return Trim(R)

    End Function

    Public Sub TrimLineTabs(ByRef line As String)

        line = Replace(line, Chr(9), Chr(32))

        'make all spaces 1 space long
        Dim it As Integer = 1
        Dim trim As Boolean
        Dim str As String = ""
        Do Until it > line.Length
            If Not trim Or (trim And Not (Mid(line, it, 1) = " ")) Then
                str &= Mid(line, it, 1)
            End If
            trim = (Mid(line, it, 1) = " ")
            it += 1
        Loop
        line = str
        '//

    End Sub

End Module